﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.IO;
namespace Tailoring
{
   class programcodes:frmentry
    {
       
       
        private long m_lImageFileLength = 0;
        private byte[] m_barrImg;
        public programcodes()
        {
        
        }
        public PictureBox LoadImage(PictureBox pb)
        {
            //PictureBox pb = new PictureBox();
            try
            {

                frmentry f = new frmentry();
               
                OpenFileDialog odb = new OpenFileDialog();
                odb.ShowDialog(this);
                string strFn = odb.FileName;

                pb.Image = Image.FromFile(strFn);
                FileInfo fiImage = new FileInfo(strFn);
                this.m_lImageFileLength = fiImage.Length;
                FileStream fs = new FileStream(strFn, FileMode.Open,
                                  FileAccess.Read, FileShare.Read);
                m_barrImg = new byte[Convert.ToInt32(this.m_lImageFileLength)];
                int iBytesRead = fs.Read(m_barrImg, 0,
                                 Convert.ToInt32(this.m_lImageFileLength));
                fs.Close();
            
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return pb;
        }
        public static SqlConnection getConnect()
        {

            string str = "Server= localhost; database=tailoringmng; integrated Security=true";

            SqlConnection con = new SqlConnection(str);
            try
            {
                con.Open();
            }
            catch 
                {
                
                }
            return con;
        }
    }
    
}
